const state = {
  dutyModalVisible: false, // 是否显示任职对话框
  dutyModalTitle: '', // 对话框标题
  dutyModalType: '', // 对话框类型
  manageModalVisible: false, // 是否显示任职管理对话框
  resetModalVisible: false, // 是否显示重置密码对话框
};

const getters = {
  dutyModalVisible: (state) => state.dutyModalVisible,
  dutyModalTitle: (state) => state.dutyModalTitle,
  dutyModalType: (state) => state.dutyModalType,
  manageModalVisible: (state) => state.manageModalVisible,
  resetModalVisible: (state) => state.resetModalVisible,
};

const mutations = {
  SET_DUTY_MODAL_VISIBLE: (state, visible) => {
    state.dutyModalVisible = visible;
  },
  SET_DUTY_MODAL_TITLE: (state, title) => {
    state.dutyModalTitle = title;
  },
  SET_DUTY_MODAL_TYPE: (state, type) => {
    state.dutyModalType = type;
  },
  SET_MANAGE_MODAL_VISIBLE: (state, visible) => {
    state.manageModalVisible = visible;
  },
  SET_RESET_MODAL_VISIBLE: (state, visible) => {
    state.resetModalVisible = visible;
  },
};

const actions = {
  setDutyModalVisible: ({ commit }, visible) => {
    commit('SET_DUTY_MODAL_VISIBLE', visible);
  },
  setDutyModalTitle: ({ commit }, title) => {
    commit('SET_DUTY_MODAL_TITLE', title);
  },
  setDutyModalType: ({ commit }, type) => {
    commit('SET_DUTY_MODAL_TYPE', type);
  },
  setManageModalVisible: ({ commit }, visible) => {
    commit('SET_MANAGE_MODAL_VISIBLE', visible);
  },
  setResetModalVisible: ({ commit }, visible) => {
    commit('SET_RESET_MODAL_VISIBLE', visible);
  },
};

export default {
  getters,
  state,
  mutations,
  actions,
};
